<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>简单整合Spring+SpringMVC+Mybatis | HankChan&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="最近一直想总结一下Spring+SpringMVC+Mybatis的整合过程，也便于以后忘了什么细节的东西却要用到的时候面对海量的搜索结果不好选择。下面是我参考一些文档博文，自己动手总结出来的一些东西。浅显勿怪！首先是相关框架的职责功能：》SpringMVC：负责表现层》Service接口：处理业务》Mapper：持久层(相当于DAO接口)》Spring：将各个层整合，管理持久层的Mapper，管">
<meta property="og:type" content="article">
<meta property="og:title" content="简单整合Spring+SpringMVC+Mybatis">
<meta property="og:url" content="http://hexo.hankchan.cn/2016/04/22/e7-ae-80-e5-8d-95-e6-95-b4-e5-90-88springspringmvcmybatis/index.html">
<meta property="og:site_name" content="HankChan&#39;s Blog">
<meta property="og:description" content="最近一直想总结一下Spring+SpringMVC+Mybatis的整合过程，也便于以后忘了什么细节的东西却要用到的时候面对海量的搜索结果不好选择。下面是我参考一些文档博文，自己动手总结出来的一些东西。浅显勿怪！首先是相关框架的职责功能：》SpringMVC：负责表现层》Service接口：处理业务》Mapper：持久层(相当于DAO接口)》Spring：将各个层整合，管理持久层的Mapper，管">
<meta property="og:image" content="http://img.blog.csdn.net/20160422132741512">
<meta property="og:updated_time" content="2017-05-26T02:13:23.615Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="简单整合Spring+SpringMVC+Mybatis">
<meta name="twitter:description" content="最近一直想总结一下Spring+SpringMVC+Mybatis的整合过程，也便于以后忘了什么细节的东西却要用到的时候面对海量的搜索结果不好选择。下面是我参考一些文档博文，自己动手总结出来的一些东西。浅显勿怪！首先是相关框架的职责功能：》SpringMVC：负责表现层》Service接口：处理业务》Mapper：持久层(相当于DAO接口)》Spring：将各个层整合，管理持久层的Mapper，管">
<meta name="twitter:image" content="http://img.blog.csdn.net/20160422132741512">
  
    <link rel="alternate" href="/atom.xml" title="HankChan&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">HankChan&#39;s Blog</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">生活就像海洋</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://hexo.hankchan.cn"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-e7-ae-80-e5-8d-95-e6-95-b4-e5-90-88springspringmvcmybatis" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2016/04/22/e7-ae-80-e5-8d-95-e6-95-b4-e5-90-88springspringmvcmybatis/" class="article-date">
  <time datetime="2016-04-22T06:20:25.000Z" itemprop="datePublished">2016-04-22</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/Mybatis/">Mybatis</a>►<a class="article-category-link" href="/categories/Mybatis/Spring/">Spring</a>►<a class="article-category-link" href="/categories/Mybatis/Spring/SpringMVC/">SpringMVC</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      简单整合Spring+SpringMVC+Mybatis
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <div id="wmd-preview-section-18" class="wmd-preview-section preview-content"><br><br>最近一直想总结一下Spring+SpringMVC+Mybatis的整合过程，也便于以后忘了什么细节的东西却要用到的时候面对海量的搜索结果不好选择。<br>下面是我参考一些文档博文，自己动手总结出来的一些东西。浅显勿怪！<br><br>首先是相关框架的职责功能：<br>》SpringMVC：负责表现层<br>》Service接口：处理业务<br>》Mapper：持久层(相当于DAO接口)<br>》Spring：将各个层整合，管理持久层的Mapper，管理业务层的Service，管理表现层的Handler。<br>》》在Handler中可以调用Service接口，在Service接口中可以调用Mapper接口。(为了记忆我通常用“A-S-D”来记住调用关系)<br><br></div><br><div id="wmd-preview-section-19" class="wmd-preview-section preview-content"><br><br>### 下面是具体的整合思路：<br><br></div><br><div id="wmd-preview-section-20" class="wmd-preview-section preview-content"><br><br>#### 第一步：整合DAO层(Mybatis和Spring整合，通过Spring管理Mapper接口)：使用Mapper的扫描器自动扫描Mapper接口在Spring容器中注册。<br><br></div><br><div id="wmd-preview-section-21" class="wmd-preview-section preview-content"><br><br>#### 第二步：整合Service层(通过Spring管理Service接口)：使用配置方式将Service接口配置在Spring配置文件中，实现事务控制。<br><br></div><br><div id="wmd-preview-section-22" class="wmd-preview-section preview-content"><br><br>#### 第三步：整合SpringMVC(因为SpringMVC是Spring的一个子模块，故而无需进一步做整合操作)。<br><br></div><br><div id="wmd-preview-section-23" class="wmd-preview-section preview-content"><br><br>### 接下来做具体的环境搭建操作<br><br></div><br><div id="wmd-preview-section-24" class="wmd-preview-section preview-content"><br><br>#### 1. 新建动态web工程，建立目录结构并导入包括spring、mybatis、c3p0、mysql等相关的jar包。<br><br>以下是我的目录结构：<br><img src="http://img.blog.csdn.net/20160422132741512" alt="这里写图片描述"><br><br></div><br><div id="wmd-preview-section-25" class="wmd-preview-section preview-content"><br><br>#### 2. 配置web.xml文件：<br><br>》1.配置Spring容器：ContextLoaderListener及spring配置文件的路径地址<br>在这里我采用了restful风格的applicationContext-<em>.xml的spring配置文件的配置<br>》2.配置DispatcherServlet前端控制器并指明前端控制器的配置文件上下文配置文件的位置<br>在这里我不使用默认定义命名，而是使用了自己定义的配置文件名：springmvc.xml<br>》3.可以配置编码过滤器<br>具体代码如下：<br><br></em></div><br><div id="wmd-preview-section-26" class="wmd-preview-section preview-content"><br><br>    <span class="hljs-pi">&lt;?xml version=”1.0” encoding=”UTF-8”?&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-title">web-app</span> <span class="hljs-attribute">xmlns:xsi</span>=<span class="hljs-value">“<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="external">http://www.w3.org/2001/XMLSchema-instance</a>“</span> <span class="hljs-attribute">xmlns</span>=<span class="hljs-value">“<a href="http://java.sun.com/xml/ns/javaee" target="_blank" rel="external">http://java.sun.com/xml/ns/javaee</a>“</span> <span class="hljs-attribute">xsi:schemaLocation</span>=<span class="hljs-value">“<a href="http://java.sun.com/xml/ns/javaee" target="_blank" rel="external">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" target="_blank" rel="external">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>“</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">“WebApp_ID”</span> <span class="hljs-attribute">version</span>=<span class="hljs-value">“2.5”</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-title">display-name</span>&gt;</span>ssm<span class="hljs-tag">&lt;/<span class="hljs-title">display-name</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-title">welcome-file-list</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">welcome-file</span>&gt;</span>index.jsp<span class="hljs-tag">&lt;/<span class="hljs-title">welcome-file</span>&gt;</span><br>      <span class="hljs-tag">&lt;/<span class="hljs-title">welcome-file-list</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置Spring容器 –&gt;</span><br>      <span class="hljs-comment">&lt;!– needed for ContextLoaderListener –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">context-param</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">param-name</span>&gt;</span>contextConfigLocation<span class="hljs-tag">&lt;/<span class="hljs-title">param-name</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">param-value</span>&gt;</span>classpath:spring/applicationContext-.xml<span class="hljs-tag">&lt;/<span class="hljs-title">param-value</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">context-param</span>&gt;</span><br>        <span class="hljs-comment">&lt;!– Bootstraps the root web application context before servlet initialization –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">listener</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">listener-class</span>&gt;</span>org.springframework.web.context.ContextLoaderListener<span class="hljs-tag">&lt;/<span class="hljs-title">listener-class</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">listener</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置前端控制器 –&gt;</span><br>        <span class="hljs-comment">&lt;!– The front controller of this Spring Web application, responsible for handling all application requests –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">servlet</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">servlet-name</span>&gt;</span>springmvc<span class="hljs-tag">&lt;/<span class="hljs-title">servlet-name</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">servlet-class</span>&gt;</span>org.springframework.web.servlet.DispatcherServlet<span class="hljs-tag">&lt;/<span class="hljs-title">servlet-class</span>&gt;</span><br>            <span class="hljs-comment">&lt;!– 加载前端控制器配置文件 上下文配置文件的位置 –&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">init-param</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">param-name</span>&gt;</span>contextConfigLocation<span class="hljs-tag">&lt;/<span class="hljs-title">param-name</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">param-value</span>&gt;</span>classpath:spring/springmvc.xml<span class="hljs-tag">&lt;/<span class="hljs-title">param-value</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-title">init-param</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">load-on-startup</span>&gt;</span>1<span class="hljs-tag">&lt;/<span class="hljs-title">load-on-startup</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">servlet</span>&gt;</span><br>        <span class="hljs-comment">&lt;!– Map all requests to the DispatcherServlet for handling –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">servlet-mapping</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">servlet-name</span>&gt;</span>springmvc<span class="hljs-tag">&lt;/<span class="hljs-title">servlet-name</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">url-pattern</span>&gt;</span>/<span class="hljs-tag">&lt;/<span class="hljs-title">url-pattern</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">servlet-mapping</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 编码过滤配置 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">filter</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">filter-name</span>&gt;</span>CharacterEncodingFilter<span class="hljs-tag">&lt;/<span class="hljs-title">filter-name</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">filter-class</span>&gt;</span>org.springframework.web.filter.CharacterEncodingFilter<span class="hljs-tag">&lt;/<span class="hljs-title">filter-class</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">init-param</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">param-name</span>&gt;</span>encoding<span class="hljs-tag">&lt;/<span class="hljs-title">param-name</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">param-value</span>&gt;</span>utf-8<span class="hljs-tag">&lt;/<span class="hljs-title">param-value</span>&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-title">init-param</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">filter</span>&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">filter-mapping</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">filter-name</span>&gt;</span>CharacterEncodingFilter<span class="hljs-tag">&lt;/<span class="hljs-title">filter-name</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">url-pattern</span>&gt;</span>/<em><span class="hljs-tag">&lt;/<span class="hljs-title">url-pattern</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">filter-mapping</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;/<span class="hljs-title">web-app</span>&gt;</span><code>&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-27&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;

    #### 3\. 配置applicationContext.xml文件

    》1.在web.xml指定的命名方式和路径下在spring目录下新建applicationContext-dao.xml配置文件：
    》2.配置加载db.properties：指定配置文件路径
    》3.配置数据源：配置dataSource及其username，password，driverClass等属性
    》4.配置SqlSessionFactoryBean：配置SqlSessionFactoryBean的bean并引用dataSource和加载mybatis的全局配置文件sqlMapConfig.xml的路径位置
    》5.配置Mapper扫描器：配置mapper扫描器的bean并配置其扫描mapper的包basePackage的路径，同时在设置其sqlSessionFactoryBeanName属性时注意不能使用ref，否则会因为前面加载配置文件导致这里报错，要使用value设置属性值。
    具体代码如下：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-28&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code><span class="hljs-pi">&lt;?xml version=”1.0” encoding=”UTF-8”?&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-title">beans</span> <span class="hljs-attribute">xmlns</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a>“</span><br>        <span class="hljs-attribute">xmlns:xsi</span>=<span class="hljs-value">“<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="external">http://www.w3.org/2001/XMLSchema-instance</a>“</span><br>        <span class="hljs-attribute">xmlns:context</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/context" target="_blank" rel="external">http://www.springframework.org/schema/context</a>“</span><br>        <span class="hljs-attribute">xsi:schemaLocation</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans.xsd" target="_blank" rel="external">http://www.springframework.org/schema/beans/spring-beans.xsd</a><br>            <a href="http://www.springframework.org/schema/context" target="_blank" rel="external">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-4.2.xsd" target="_blank" rel="external">http://www.springframework.org/schema/context/spring-context-4.2.xsd</a>“</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 加载数据库配置文件 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">context:property-placeholder</span> <span class="hljs-attribute">location</span>=<span class="hljs-value">“classpath:db.properties”</span>/&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置数据源 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">bean</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">“dataSource”</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">“com.mchange.v2.c3p0.ComboPooledDataSource”</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“user”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“${jdbc.username}”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“password”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“${jdbc.password}”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“jdbcUrl”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“${jdbc.jdbcUrl}”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“driverClass”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“${jdbc.driverClass}”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">bean</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置SqlSessionFactoryBean –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">bean</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">“sqlSessionFactoryBean”</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">“org.mybatis.spring.SqlSessionFactoryBean”</span>&gt;</span><br>            <span class="hljs-comment">&lt;!– 数据源 –&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“dataSource”</span> <span class="hljs-attribute">ref</span>=<span class="hljs-value">“dataSource”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>            <span class="hljs-comment">&lt;!– 加载mybatis的全局配置文件 –&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“configLocation”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“classpath:mybatis/sqlMapConfig.xml”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">bean</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置mapper扫描器 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">bean</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">“org.mybatis.spring.mapper.MapperScannerConfigurer”</span>&gt;</span><br>            <span class="hljs-comment">&lt;!– 扫描mapper的包路径, 如果需要扫描多个包中间用半角逗号隔开 –&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“basePackage”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“cn.hankchan.mapper”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>            <span class="hljs-comment">&lt;!– 不能使用ref=”” 因为上面加载配置文件导致这里引用会报错 –&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“sqlSessionFactoryBeanName”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“sqlSessionFactoryBean”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">bean</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;/<span class="hljs-title">beans</span>&gt;</span><code>&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-29&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;

    #### 4\. 配置applicationContext-service.xml配置文件

    》配置扫描Service的包路径：
    只用于加载Service组件。
    具体代码如下：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-30&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code><span class="hljs-pi">&lt;?xml version=”1.0” encoding=”UTF-8”?&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-title">beans</span> <span class="hljs-attribute">xmlns</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a>“</span><br>        <span class="hljs-attribute">xmlns:xsi</span>=<span class="hljs-value">“<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="external">http://www.w3.org/2001/XMLSchema-instance</a>“</span><br>        <span class="hljs-attribute">xmlns:context</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/context" target="_blank" rel="external">http://www.springframework.org/schema/context</a>“</span><br>        <span class="hljs-attribute">xsi:schemaLocation</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans.xsd" target="_blank" rel="external">http://www.springframework.org/schema/beans/spring-beans.xsd</a><br>            <a href="http://www.springframework.org/schema/context" target="_blank" rel="external">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-4.2.xsd" target="_blank" rel="external">http://www.springframework.org/schema/context/spring-context-4.2.xsd</a>“</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 扫描Service –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">context:component-scan</span> <span class="hljs-attribute">base-package</span>=<span class="hljs-value">“cn.hankchan.service.impl”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">context:component-scan</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;/<span class="hljs-title">beans</span>&gt;</span><code>&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-31&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;

    #### 5\. 配置applicationContext-transaction.xml文件

    》主要用于事务处理。具体用途请自己查阅资料学习相关的知识，我自己忘得差不多了。就不废话了，直接上代码。(需要说明的是：因为一些不记得什么原因的原因，这个文件有一个配置的错误，所以我是直接注掉不使用事务管理的。留待后续再解决。)
    代码如下：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-32&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code><span class="hljs-pi">&lt;?xml version=”1.0” encoding=”UTF-8”?&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-title">beans</span> <span class="hljs-attribute">xmlns</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a>“</span><br>        <span class="hljs-attribute">xmlns:xsi</span>=<span class="hljs-value">“<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="external">http://www.w3.org/2001/XMLSchema-instance</a>“</span><br>        <span class="hljs-attribute">xmlns:tx</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/tx" target="_blank" rel="external">http://www.springframework.org/schema/tx</a>“</span><br>        <span class="hljs-attribute">xmlns:aop</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/aop" target="_blank" rel="external">http://www.springframework.org/schema/aop</a>“</span><br>        <span class="hljs-attribute">xsi:schemaLocation</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans.xsd" target="_blank" rel="external">http://www.springframework.org/schema/beans/spring-beans.xsd</a><br>            <a href="http://www.springframework.org/schema/aop" target="_blank" rel="external">http://www.springframework.org/schema/aop</a> <a href="http://www.springframework.org/schema/aop/spring-aop-4.2.xsd" target="_blank" rel="external">http://www.springframework.org/schema/aop/spring-aop-4.2.xsd</a><br>            <a href="http://www.springframework.org/schema/tx" target="_blank" rel="external">http://www.springframework.org/schema/tx</a> <a href="http://www.springframework.org/schema/tx/spring-tx-4.2.xsd" target="_blank" rel="external">http://www.springframework.org/schema/tx/spring-tx-4.2.xsd</a>“</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 事务管理器 对mybatis操作数据库事务控制，spring使用jdbc的事务控制类 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">bean</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">“transactionManager”</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">“org.springframework.jdbc.datasource.DataSourceTransactionManager”</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“dataSource”</span> <span class="hljs-attribute">ref</span>=<span class="hljs-value">“dataSource”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">bean</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 通知 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">tx:advice</span> <span class="hljs-attribute">id</span>=<span class="hljs-value">“txAdvice”</span> <span class="hljs-attribute">transaction-manager</span>=<span class="hljs-value">“transactionManager”</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">tx:attributes</span>&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“save</span></span></em>“ <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“REQUIRED”</span>/&gt;<br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“delete<em>“</em></span> <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“REQUIRED”</span>/&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“insert“</span> <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“REQUIRED”</span>/&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“update<em>“</em></span> <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“REQUIRED”</span>/&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“find“</span> <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“SUPPORTS”</span> <span class="hljs-attribute">read-only</span>=<span class="hljs-value">“true”</span>/&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“get<em>“</em></span> <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“SUPPORTS”</span> <span class="hljs-attribute">read-only</span>=<span class="hljs-value">“true”</span>/&gt;</span><br>                <span class="hljs-tag">&lt;<span class="hljs-title">tx:method</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“select“</span> <span class="hljs-attribute">propagation</span>=<span class="hljs-value">“SUPPORTS”</span> <span class="hljs-attribute">read-only</span>=<span class="hljs-value">“true”</span>/&gt;</span><br>            <span class="hljs-tag">&lt;/<span class="hljs-title">tx:attributes</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">tx:advice</span>&gt;</span><br>      <span class="hljs-comment">&lt;!– AOP –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">aop:config</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">aop:advisor</span> <span class="hljs-attribute">advice-ref</span>=<span class="hljs-value">“txAdvice”</span><br>                <span class="hljs-attribute">pointcut</span>=<span class="hljs-value">“execution(<em> cn.hankchan.service.impl.</em>.*(..))”</span>/&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">aop:config</span>&gt;</span><br><br>    <span class="hljs-tag">&lt;/<span class="hljs-title">beans</span>&gt;</span><code>&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-33&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;

    #### 6\. 接下来配置前端控制器的配置文件springmvc.xml

    》1.配置扫描Controller的路径
    》2.配置注解的映射器和适配器
    》3.配置视图解析器及响应路径的前后缀
    这是很基础的东西，不多解释，直接上代码：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-34&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code><span class="hljs-pi">&lt;?xml version=”1.0” encoding=”UTF-8”?&gt;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-title">beans</span> <span class="hljs-attribute">xmlns</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a>“</span><br>        <span class="hljs-attribute">xmlns:xsi</span>=<span class="hljs-value">“<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank" rel="external">http://www.w3.org/2001/XMLSchema-instance</a>“</span><br>        <span class="hljs-attribute">xmlns:context</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/context" target="_blank" rel="external">http://www.springframework.org/schema/context</a>“</span><br>        <span class="hljs-attribute">xmlns:mvc</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/mvc" target="_blank" rel="external">http://www.springframework.org/schema/mvc</a>“</span><br>        <span class="hljs-attribute">xsi:schemaLocation</span>=<span class="hljs-value">“<a href="http://www.springframework.org/schema/mvc" target="_blank" rel="external">http://www.springframework.org/schema/mvc</a> <a href="http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd" target="_blank" rel="external">http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd</a><br>            <a href="http://www.springframework.org/schema/beans" target="_blank" rel="external">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans.xsd" target="_blank" rel="external">http://www.springframework.org/schema/beans/spring-beans.xsd</a><br>            <a href="http://www.springframework.org/schema/context" target="_blank" rel="external">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-4.2.xsd" target="_blank" rel="external">http://www.springframework.org/schema/context/spring-context-4.2.xsd</a>“</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 扫描Controller –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">context:component-scan</span> <span class="hljs-attribute">base-package</span>=<span class="hljs-value">“cn.hankchan.controller”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">context:component-scan</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置注解的映射器和适配器 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">mvc:annotation-driven</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">mvc:annotation-driven</span>&gt;</span><br><br>      <span class="hljs-comment">&lt;!– 配置视图解析器 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">bean</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">“org.springframework.web.servlet.view.InternalResourceViewResolver”</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“prefix”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“/WEB-INF/jsp/“</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“suffix”</span> <span class="hljs-attribute">value</span>=<span class="hljs-value">“.jsp”</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">bean</span>&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-title">beans</span>&gt;</span><code>&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-35&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;

    #### 7\. 最后我们配置mybatis的配置文件：sqlMapConfig.xml

    》主要用于配置mybatis框架的一些设置如配置pojo类的别名、开启二级缓存等等。
    代码如下：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-36&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code><span class="hljs-pi">&lt;?xml version=”1.0” encoding=”UTF-8”?&gt;</span><br>    <span class="hljs-doctype">&lt;!DOCTYPE configuration<br>    PUBLIC “-//mybatis.org//DTD Config 3.0//EN”<br>    “<a href="http://mybatis.org/dtd/mybatis-3-config.dtd&quot;&amp;gt" target="_blank" rel="external">http://mybatis.org/dtd/mybatis-3-config.dtd&quot;&amp;gt</a>;</span><br>    <span class="hljs-tag">&lt;<span class="hljs-title">configuration</span>&gt;</span><br>        <span class="hljs-comment">&lt;!– 全局setting配置，根据需要添加 –&gt;</span><br>        <span class="hljs-comment">&lt;!– 配置别名 –&gt;</span><br>        <span class="hljs-tag">&lt;<span class="hljs-title">typeAliases</span>&gt;</span><br>            <span class="hljs-comment">&lt;!– 批量扫描设置别名 –&gt;</span><br>            <span class="hljs-tag">&lt;<span class="hljs-title">package</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">“cn.hankchan.po”</span>/&gt;</span><br>        <span class="hljs-tag">&lt;/<span class="hljs-title">typeAliases</span>&gt;</span><br>        <span class="hljs-comment">&lt;!– 配置Mapper<br>            备注: 由于使用Spring整合mybatis的整合包进行mapper扫描，这里无需配置<br>            必须遵循mapper.xml和mapper.java文件同名且在同一文件目录下<br>         –&gt;</span><br>    <span class="hljs-tag">&lt;/<span class="hljs-title">configuration</span>&gt;</span><code>&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-37&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;

    #### 8\. 编写配置db.properties、log4j.properties等相关的配置文件

    根据情况自己设置相关的参数，我的相关代码如下：
    db.properties：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-38&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code>jdbc<span class="hljs-preprocessor">.username</span>=root<br>    jdbc<span class="hljs-preprocessor">.password</span>=<br>    jdbc<span class="hljs-preprocessor">.jdbcUrl</span>=<span class="hljs-keyword">com</span><span class="hljs-preprocessor">.mysql</span><span class="hljs-preprocessor">.jdbc</span><span class="hljs-preprocessor">.Driver</span><br>    jdbc<span class="hljs-preprocessor">.driverClass</span>=jdbc:mysql:///qxt<code>&lt;/pre&gt;
    log4j.properties：

    &lt;/div&gt;
    &lt;div id=&quot;wmd-preview-section-39&quot; class=&quot;wmd-preview-section preview-content&quot;&gt;
    &lt;pre class=&quot;prettyprint&quot;&gt;</code>log4j<span class="hljs-preprocessor">.rootLogger</span>=DEBUG, stdout<br>    <span class="hljs-preprocessor"># Console output…</span><br>    log4j<span class="hljs-preprocessor">.appender</span><span class="hljs-preprocessor">.stdout</span>=org<span class="hljs-preprocessor">.apache</span><span class="hljs-preprocessor">.log</span>4j<span class="hljs-preprocessor">.ConsoleAppender</span><br>    log4j<span class="hljs-preprocessor">.appender</span><span class="hljs-preprocessor">.stdout</span><span class="hljs-preprocessor">.layout</span>=org<span class="hljs-preprocessor">.apache</span><span class="hljs-preprocessor">.log</span>4j<span class="hljs-preprocessor">.PatternLayout</span><br>    log4j<span class="hljs-preprocessor">.appender</span><span class="hljs-preprocessor">.stdout</span><span class="hljs-preprocessor">.layout</span><span class="hljs-preprocessor">.ConversionPattern</span>=%<span class="hljs-number">5</span>p [%t] - %m%n<br><br>到了这里，整合SSM的环境基本上就搭建完成。<br>我在相关目录下新建了XxxPo.java，XxxMapper.java，XxxMapper.xml，XxxController.java，XxxService.java，XxxServiceImpl.java用于测试。具体的类可以根据需求自己设计添加。<br>运行一次如果不报错的话说明这个整合过程是成功了。<br>拖了好一阵子，终于把这个整合思路过程自己记录了下路，BINGO！！<br><br></div>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://hexo.hankchan.cn/2016/04/22/e7-ae-80-e5-8d-95-e6-95-b4-e5-90-88springspringmvcmybatis/" data-id="cj359k3xx000rfwv71gr5a3w7" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2016/05/04/springmvc-e5-86-99-e4-b8-80-e4-b8-aa-e8-be-93-e5-87-ba-e4-b8-bajackson-e6-a0-bc-e5-bc-8f-e5-a6-82xml-e3-80-81json-e7-9a-84api-e7-9a-84-e5-b0-8f-e7-ac-94-e8-ae-b0/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          SpringMVC写一个输出为Jackson格式(如xml、json)的api的小笔记
        
      </div>
    </a>
  
  
    <a href="/2016/04/12/springmvc-e9-80-9a-e8-bf-87-e4-b8-8d-e5-90-8c-e7-9a-84url-e8-bf-94-e5-9b-9ejson-e5-af-b9-e8-b1-a1-e5-b9-b6-e5-9c-a8-e5-89-8d-e7-ab-af-e6-98-be-e7-a4-ba-e7-9a-84-e8-a7-a3-e5-86-b3-e6-96-b9-e6-b3-95/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">SpringMVC通过不同的url返回Json对象并在前端显示的解决方法</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">分类</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Docker/">Docker</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Eclipse/">Eclipse</a><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/Eclipse/Mybatis/">Mybatis</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Eclipse/Spring/">Spring</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Eclipse/分布式/">分布式</a></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Git/">Git</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/Nginx/">Nginx</a></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Mybatis/">Mybatis</a><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/Mybatis/Spring/">Spring</a><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/Mybatis/Spring/SpringMVC/">SpringMVC</a></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Mybatis/SpringMVC/">SpringMVC</a></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Nginx/">Nginx</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Spring/">Spring</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/SpringMVC/">SpringMVC</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/分布式/">分布式</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/日志管理/">日志管理</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/未分类/">未分类</a></li></ul>
    </div>
  </div>


  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">三月 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/01/">一月 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/10/">十月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/09/">九月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">七月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">六月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/05/">五月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">四月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">三月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">二月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">一月 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">十二月 2015</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2017/03/13/docker-e5-be-ae-e6-9c-8d-e5-8a-a1-e5-ae-b9-e5-99-a8-e5-8c-96-e5-bc-80-e5-8f-91-e6-8e-a2-e7-b4-a2/">Docker-微服务容器化开发探索</a>
          </li>
        
          <li>
            <a href="/2017/01/20/drds-e7-bb-93-e5-90-88mybatis-e8-a7-a3-e5-86-b3-e6-96-b9-e6-a1-88-e4-b8-8e-e8-a7-84-e8-8c-83/">DRDS结合Mybatis解决方案与规范</a>
          </li>
        
          <li>
            <a href="/2017/01/03/springmvc-thymeleaf-e5-bc-80-e5-8f-91-e6-8c-87-e5-8d-97-demo/">SpringMVC-Thymeleaf-开发指南-Demo</a>
          </li>
        
          <li>
            <a href="/2016/10/16/nginx-e4-bb-a3-e7-90-86-e6-9c-8d-e5-8a-a1-e5-99-a8-e6-96-b9-e5-bc-8f-e8-a7-a3-e5-86-b3-e5-ae-9e-e9-99-85-e5-bc-80-e5-8f-91-e4-b8-adajax-e8-af-b7-e6-b1-82-e7-9a-84-e8-b7-a8-e5-9f-9f-e9-97-ae-e9-a2-98/">Nginx代理服务器方式解决实际开发中Ajax请求的跨域问题</a>
          </li>
        
          <li>
            <a href="/2016/10/11/e5-b7-a5-e5-8e-82-e6-a8-a1-e5-bc-8f-e5-92-8c-e5-8d-95-e4-be-8b-e6-a8-a1-e5-bc-8f-e7-bb-93-e5-90-88-e5-ba-94-e7-94-a8-e7-9a-84-e5-9c-ba-e6-99-af-e6-80-9d-e8-80-83/">工厂模式和单例模式结合应用的场景思考</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 Hank Chan<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>